/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.p10.miage.gestionabsence.model;

import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author Sofian Seid
 */
public class Connection {

    private static java.sql.Connection cx;
    
    public Connection() { 
        try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
        }
        catch( ClassNotFoundException ex ) {
            System.err.println( "Erreur lors du chargement du driver" );
            System.exit(1);
        }
        try {
//            String url="jdbc:oracle:thin:@miage03.dmiage.u-paris10.fr:1521:MIAGE";
//            Connection.cx =DriverManager.getConnection (url,"chhenzel","classique2012pw");
            String url="jdbc:oracle:thin:@192.168.0.18:1521:orcl";
            Connection.cx =DriverManager.getConnection (url,"hr","oracle");            
            
        }
        catch( SQLException ex ) {
            System.err.println( "Erreur lors de la cx à la base: "+ex );
            System.exit(1);
        }
    }
    
    public static java.sql.Connection getBDD(){
        
        if(Connection.cx==null){
            Connection connection = new Connection();
        }
        return Connection.cx;
    }

    public Statement createStatement() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
    
}
